package servlet.startup;

import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Create By IntelliJ IDEA
 *
 * @Author: jsonor
 * @Create-Time: 2017/9/26 10:50
 * @Description: 获取参数
 */
public class ParamServlet extends HttpServlet{

  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {


    // 获取自己的初始化参数, 无法获取，因为没有设置
    // getInitParameter("key1");

    ServletContext ctx = getServletContext();
    ctx.getInitParameter("name");
    ctx.getInitParameter("password");
  }
}
